﻿using System;
using System.Collections.Generic;
using CrystalDecisions.CrystalReports.Engine;
using ATSDAL;
using ATSModel;
public partial class Calibration_CalibrationDetails_electricalProperties : System.Web.UI.Page
{
    private ReportDocument doc = new ReportDocument();

    private void Page_Unload(object sender, EventArgs e)
    {
        doc.Dispose();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Unload += new EventHandler(Page_Unload);
    }
    public IList<TCalElectricalPropertyItem> GetlElectricalPropertyData()
    {
        IList<TCalElectricalPropertyItem> testItems = new List<TCalElectricalPropertyItem>();
        TCalElectricalProperty testItem = new TCalElectricalProperty();
     
        DateTime dt1 = (DateTime)Session["startTime"];
        DateTime dt2 = (DateTime)Session["stopTime"];
        string Id = (string)Session["InID"];

       testItems = testItem.GetElectricalPropertyItemByDTAndID(dt1, dt2, Id);
       
      
        return testItems;
    }

    protected void CrystalReportViewer1_Init(object sender, EventArgs e)
    {
        ForCrystalReport();
    }

    protected void ForCrystalReport()
    {
           doc.Load(Server.MapPath("electricalProperties.rpt"));

            TextObject txtTitle = (TextObject)doc.ReportDefinition.ReportObjects["Text1"];
            txtTitle.Text = (string)Session["item"] + "测试仪器/校准件校验记录表";

            IList<TCalElectricalPropertyItem> list = GetlElectricalPropertyData();
            doc.SetDataSource(list);
            this.CrystalReportViewer1.ReportSource = doc;

    }

}
